import React, {
    useCallback,
    useEffect,
    useLayoutEffect,
    useMemo,
    useState
} from "react";
import {connect, useDispatch} from "react-redux";
import intl from "react-intl-universal";
import moment from "moment";
import {LgTabs } from "lancoo-web-ui";
import Empty from "../../../../../../common/component/empty";
import axiosMethod from "../../../../../../common/axios/index";
import { Popover } from "antd";
import { getRangeDate, getDateType, getDateWeek, constructionDate, getNumberHZ } from "../../../../../../common/util/index";
import "./index.scss";
import Scrollbars from "react-custom-scrollbars";

function MyScheduleMonth(props){
    let {
        userInfo,
        changeCurrentType,
        chooseDate,
        scheduleList,
        showDayType,
        holidayList,
        deleteSchedule,
        editSchedule,
        goCourse,
        goExternal,
        changeCourse
    } = props;
    const [weekList, setWeekList] = useState(["星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"]);
    const [typeScheduleList, setTypeScheduleList] = useState([]);
    const [scheduleInfo, setScheduleInfo] = useState({});
    const [detailTabData, setDetailTabData] = useState({});
    const [scheduleJoinInfo, setScheduleJoinInfo] = useState({});
    const [popoverOpen, setPopoverOpen] = useState(false);

    const getScheduleInfo = useCallback((data, visible, index, index2)=>{  //获取某一日程详情
        // setPopoverOpen(visible);
        if(!visible){
            // setScheduleInfo({});
            // setScheduleJoinInfo({});
            return;
        }
        // typeScheduleList.forEach(item=>Array.isArray(item.list) && item.list.forEach(child=>child.show=false));
        // if(index>=-1){
        //     if(index===-1){
        //         typeScheduleList.forEach(item=>{
        //             Array.isArray(item.list) &&
        //             item.list.forEach(child=>{
        //                 if(child.scheduleId === data.scheduleId){
        //                     child.show = true;
        //                 }
        //             })
        //         })
        //     } else {
        //         typeScheduleList[index].list[index2].show = true;
        //     }
        // }
        
        if(data.beCourse === "1"){
            setScheduleInfo(data);
        } else {
            axiosMethod({ 
                type: "get",
                url: "api/schedule/info/detail",
                body: {
                    eduId: userInfo.eduId,
                    userId: userInfo.userId,
                    userType: userInfo.userType,
                    scheduleId: data.scheduleId
                },
                callback: function(res){
                    setScheduleVisible(false);
                    if(!res){
                        setScheduleInfo({});
                        return;
                    }
                    let rejuct = [], access = [], read = [], noResponse = [];
                    let all = res.scheduleMemberVoList?.length? res.scheduleMemberVoList: res.taskMemberVoList?.length? res.taskMemberVoList: [];
                    all.forEach((item)=>{
                        if(item.attendFlag === "0" || item.progress === "0"){
                            noResponse.push(item);
                        }
                        if(item.attendFlag === "1"){
                            read.push(item);
                        }
                        if(item.attendFlag === "2" || item.progress === "1"){
                            access.push(item);
                        }
                        if(item.attendFlag === "3" || item.progress === "3"){
                            rejuct.push(item);
                        }
                    })
                    res.joinUserInfo = {
                        "all": all.length,
                        "access": access.length,
                        "read": read.length,
                        "reject": rejuct.length,
                        "noResponse": noResponse.length
                    }
                    if(res.taskMemberVoList?.length){
                        setDetailTabData([
                            {
                                key: '0',
                                label: <span className="tab_title" data-sign="schedule">全部<i>[{all.length}]</i></span>,
                                content: (
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            all.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        {
                                                            item.attendFlag === "0"?
                                                            "":
                                                            item.attendFlag === "1"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#06f" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <circle id="椭圆_507" data-name="椭圆 507" cx="1" cy="1" r="1" transform="translate(1016 693)" fill="#fff"/>
                                                                <rect id="矩形_7752" data-name="矩形 7752" width="1" height="5" rx="0.5" transform="translate(1016 690)" fill="#fff"/>
                                                                <rect id="矩形_7753" data-name="矩形 7753" width="1" height="5" rx="0.5" transform="translate(1021 694) rotate(90)" fill="#fff"/>
                                                            </g>
                                                            </svg>:
                                                             item.attendFlag === "2"?
                                                             <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                             <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                 <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#16bb16" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                 <rect width="14" height="14" rx="3" stroke="none"/>
                                                                 <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                 </g>
                                                                 <path id="圆角矩形_5" data-name="圆角矩形 5" d="M1015.708,696.806,1013.151,694a.71.71,0,0,1,0-.936.567.567,0,0,1,.853,0l2.131,2.341,3.836-4.214a.567.567,0,0,1,.853,0,.711.711,0,0,1,0,.937l-4.263,4.681a.564.564,0,0,1-.852,0Z" fill="#fff"/>
                                                             </g>
                                                             </svg>:
                                                            item.attendFlag === "3"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="red" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <path id="联合_19" data-name="联合 19" d="M-3980.506-3051.258l-2.494-2.495-2.494,2.495a.882.882,0,0,1-1.247,0,.88.88,0,0,1,0-1.246l2.494-2.5-2.494-2.494a.882.882,0,0,1,0-1.248.882.882,0,0,1,1.247,0l2.495,2.495,2.494-2.495a.883.883,0,0,1,1.248,0,.881.881,0,0,1,0,1.248l-2.494,2.494,2.494,2.494a.881.881,0,0,1,0,1.248.881.881,0,0,1-.624.258A.883.883,0,0,1-3980.506-3051.258Z" transform="translate(5000 3749)" fill="#fff" stroke="rgba(0,0,0,0)" stroke-miterlimit="10" stroke-width="1"/>
                                                            </g>
                                                            </svg>:
                                                            ""
                                                        }
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                    
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>
                                ),
                            },{
                                key: '1',
                                label: <span className="tab_title" data-sign="schedule">已接受<i>[{access.length}]</i></span>,
                                content: (
                                    access.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            access.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                       backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="勾" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#32b432"/>
                                                            <path id="联合_7" data-name="联合 7" d="M-2907.076,8.5h-4.151a.773.773,0,0,1-.772-.773.773.773,0,0,1,.772-.772h3.475V.708a.708.708,0,0,1,.708-.708.708.708,0,0,1,.708.708V7.686q0,.018,0,.037t0,.037v.028a.708.708,0,0,1-.708.708Z" transform="translate(2804.096 2578.094) rotate(45)" fill="#fff"/>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已接受人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '2',
                                label: <span className="tab_title" data-sign="schedule">已拒绝<i>[{rejuct.length}]</i></span>,
                                content: (
                                    rejuct.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            rejuct.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="叉" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#ec5260"/>
                                                            <g id="组_6447" data-name="组 6447">
                                                            <path id="路径_4303" data-name="路径 4303" d="M741.375,522.75l4.75,4.625" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            <path id="路径_4304" data-name="路径 4304" d="M741.375,522.75l4.75,4.625" transform="translate(1268.813 -218.688) rotate(90)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            </g>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已拒绝人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '3',
                                label: <span className="tab_title" data-sign="schedule">未响应<i>[{noResponse.length}]</i></span>,
                                content: (
                                    noResponse.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            noResponse.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无未响应人员~</p>
                                    </ul>
                                ),
                            }
                        ])
                    } else {
                        setDetailTabData([
                            {
                                key: '0',
                                label: <span className="tab_title" data-sign="schedule">全部<i>[{all.length}]</i></span>,
                                content: (
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            all.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        {
                                                            item.attendFlag === "0"?
                                                            "":
                                                            item.attendFlag === "1"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#06f" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <circle id="椭圆_507" data-name="椭圆 507" cx="1" cy="1" r="1" transform="translate(1016 693)" fill="#fff"/>
                                                                <rect id="矩形_7752" data-name="矩形 7752" width="1" height="5" rx="0.5" transform="translate(1016 690)" fill="#fff"/>
                                                                <rect id="矩形_7753" data-name="矩形 7753" width="1" height="5" rx="0.5" transform="translate(1021 694) rotate(90)" fill="#fff"/>
                                                            </g>
                                                            </svg>:
                                                             item.attendFlag === "2"?
                                                             <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                             <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                 <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#16bb16" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                 <rect width="14" height="14" rx="3" stroke="none"/>
                                                                 <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                 </g>
                                                                 <path id="圆角矩形_5" data-name="圆角矩形 5" d="M1015.708,696.806,1013.151,694a.71.71,0,0,1,0-.936.567.567,0,0,1,.853,0l2.131,2.341,3.836-4.214a.567.567,0,0,1,.853,0,.711.711,0,0,1,0,.937l-4.263,4.681a.564.564,0,0,1-.852,0Z" fill="#fff"/>
                                                             </g>
                                                             </svg>:
                                                            item.attendFlag === "3"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="red" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <path id="联合_19" data-name="联合 19" d="M-3980.506-3051.258l-2.494-2.495-2.494,2.495a.882.882,0,0,1-1.247,0,.88.88,0,0,1,0-1.246l2.494-2.5-2.494-2.494a.882.882,0,0,1,0-1.248.882.882,0,0,1,1.247,0l2.495,2.495,2.494-2.495a.883.883,0,0,1,1.248,0,.881.881,0,0,1,0,1.248l-2.494,2.494,2.494,2.494a.881.881,0,0,1,0,1.248.881.881,0,0,1-.624.258A.883.883,0,0,1-3980.506-3051.258Z" transform="translate(5000 3749)" fill="#fff" stroke="rgba(0,0,0,0)" stroke-miterlimit="10" stroke-width="1"/>
                                                            </g>
                                                            </svg>:
                                                            ""
                                                        }
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                    
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>
                                ),
                            },{
                                key: '1',
                                label: <span className="tab_title" data-sign="schedule">已接受<i>[{access.length}]</i></span>,
                                content: (
                                    access.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            access.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                       backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="勾" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#32b432"/>
                                                            <path id="联合_7" data-name="联合 7" d="M-2907.076,8.5h-4.151a.773.773,0,0,1-.772-.773.773.773,0,0,1,.772-.772h3.475V.708a.708.708,0,0,1,.708-.708.708.708,0,0,1,.708.708V7.686q0,.018,0,.037t0,.037v.028a.708.708,0,0,1-.708.708Z" transform="translate(2804.096 2578.094) rotate(45)" fill="#fff"/>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已接受人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '2',
                                label: <span className="tab_title" data-sign="schedule">已拒绝<i>[{rejuct.length}]</i></span>,
                                content: (
                                    rejuct.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            rejuct.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="叉" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#ec5260"/>
                                                            <g id="组_6447" data-name="组 6447">
                                                            <path id="路径_4303" data-name="路径 4303" d="M741.375,522.75l4.75,4.625" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            <path id="路径_4304" data-name="路径 4304" d="M741.375,522.75l4.75,4.625" transform="translate(1268.813 -218.688) rotate(90)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            </g>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已拒绝人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '3',
                                label: <span className="tab_title" data-sign="schedule">待定<i>[{read.length}]</i></span>,
                                content: (
                                    read.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            read.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#06f" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <circle id="椭圆_507" data-name="椭圆 507" cx="1" cy="1" r="1" transform="translate(1016 693)" fill="#fff"/>
                                                                <rect id="矩形_7752" data-name="矩形 7752" width="1" height="5" rx="0.5" transform="translate(1016 690)" fill="#fff"/>
                                                                <rect id="矩形_7753" data-name="矩形 7753" width="1" height="5" rx="0.5" transform="translate(1021 694) rotate(90)" fill="#fff"/>
                                                            </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无待定人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '4',
                                label: <span className="tab_title" data-sign="schedule">未读<i>[{noResponse.length}]</i></span>,
                                content: (
                                    noResponse.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            noResponse.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无未读人员~</p>
                                    </ul>
                                ),
                            }
                        ])
                    }
                    
                    setScheduleInfo(res);
                }
            });
        }
        
    }, [typeScheduleList]);

    const closeTooltip = useCallback(()=>{
        // typeScheduleList.forEach(item=>Array.isArray(item.list) && item.list.forEach(child=>child.show=false));
        // setPopoverOpen(false);
        setScheduleInfo({});
        setScheduleJoinInfo({});
    }, []);

    const constructSchedulePopover = useCallback((child, index, index2, children, zIndex)=>{
        return (
            <Popover
            overlayClassName="schedule_popover"
            trigger={"click"}
            zIndex={zIndex}
            onOpenChange={(value)=>getScheduleInfo(child, value, index, index2)}
            content={(
                <div className="schedule_detail" data-sign="schedule">
                    <div className="btn_group" data-sign="schedule">
                        {
                            moment(child.scheduleDate+" "+child.endTime) < moment(constructionDate(""))?
                            child.beCourse === "1"?
                            "":
                            <svg onClick={()=>deleteSchedule(child)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                            <path id="联合_315" data-name="联合 315" d="M-15088.5,939h-9a.5.5,0,0,1-.5-.5V928h-1.5a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h13a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-1.5v10.5a.5.5,0,0,1-.5.5Zm-.5-1V928h-2v10Zm-3,0V928h-2v10Zm-3,0V928h-2v10Zm-1.5-12a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5Z" transform="translate(15100.002 -925)" fill="#ef5757"/>
                            </svg>:
                            child.beCourse === "1"?
                            <svg onClick={()=>changeCourse(child)} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
                            <path id="联合_317" data-name="联合 317" d="M11171.048,5195.141a5.248,5.248,0,0,1,.7-7.057l1.706-1.473.773,1.02-1.706,1.473a3.877,3.877,0,0,0-.514,5.212,3.329,3.329,0,0,0,4.887.548l1.616-1.4.774,1.02-1.616,1.4a4.506,4.506,0,0,1-2.958,1.118A4.59,4.59,0,0,1,11171.048,5195.141Zm8.773-2.809,1.66-1.433a3.876,3.876,0,0,0,.514-5.212,3.329,3.329,0,0,0-4.887-.548l-1.55,1.338-.773-1.02,1.549-1.338a4.508,4.508,0,0,1,6.617.741,5.247,5.247,0,0,1-.7,7.058l-1.659,1.433Zm-5.755-.485,5.281-4.695.788,1.007-5.282,4.695Z" transform="translate(-11170 -5183)" fill="#09f"/>
                            </svg>:
                            child.beExternal === "0"?
                            <>
                                <svg onClick={()=>editSchedule(child)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                                <path id="联合_176" data-name="联合 176" d="M-15086.5,939h-13a.5.5,0,0,1-.5-.5v-13a.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-6.5v12h12v-6.5a.5.5,0,0,1,.5-.5.5.5,0,0,1,.5.5v7a.5.5,0,0,1-.5.5Zm-7.3-6.2a.494.494,0,0,1,0-.7l6.362-6.367a.506.506,0,0,1,.709,0,.505.505,0,0,1,0,.709l-6.366,6.363a.492.492,0,0,1-.353.148A.492.492,0,0,1-15093.8,932.8Z" transform="translate(15100.002 -925)" fill="#09f"/>
                                </svg>
                                <svg onClick={()=>deleteSchedule(child)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                                <path id="联合_315" data-name="联合 315" d="M-15088.5,939h-9a.5.5,0,0,1-.5-.5V928h-1.5a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h13a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-1.5v10.5a.5.5,0,0,1-.5.5Zm-.5-1V928h-2v10Zm-3,0V928h-2v10Zm-3,0V928h-2v10Zm-1.5-12a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5Z" transform="translate(15100.002 -925)" fill="#ef5757"/>
                                </svg>
                            </>:
                            <svg onClick={()=>deleteSchedule(child)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                            <path id="联合_315" data-name="联合 315" d="M-15088.5,939h-9a.5.5,0,0,1-.5-.5V928h-1.5a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h13a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-1.5v10.5a.5.5,0,0,1-.5.5Zm-.5-1V928h-2v10Zm-3,0V928h-2v10Zm-3,0V928h-2v10Zm-1.5-12a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5Z" transform="translate(15100.002 -925)" fill="#ef5757"/>
                            </svg>
                        }
                        {/* <svg onClick={()=>closeTooltip(index)} xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                        <path id="联合_316" data-name="联合 316" d="M11176,5189.75l-5.251,5.252-.749-.75,5.25-5.251-5.25-5.252.752-.747,5.248,5.249,5.248-5.249.752.747-5.25,5.252,5.25,5.251-.749.75Z" transform="translate(-11170 -5183.001)" fill="#999"/>
                        </svg> */}
                    </div>
                    <p className="detail_title" title={child.scheduleTitle||child.scheduleContent}>{child.scheduleTitle||child.scheduleContent}</p>
                    <p className="detail_one">
                        <span className="one_name">时间:</span>
                        <span className="one_value">{child.scheduleDate + " "+ child.startTime}-{(child.scheduleEndDate||child.scheduleDate) + " "+ child.endTime}</span>
                    </p>
                    {
                        child.beCourse === "1"?
                        <p className="detail_one">
                            <span className="one_name">班级:</span>
                            <span className="one_value" title={child.courseClassName}>{child.courseClassName||"--"}</span>
                        </p>:
                        ""
                    }
                    {
                        child.scheduleLocation?
                        <p className="detail_one">
                            <span className="one_name">地点:</span>
                            <span className="one_value" title={child.scheduleLocation}>{child.scheduleLocation||"--"}</span>
                        </p>:
                        ""
                    }
                    {
                        child.beCourse === "1"?
                        "":
                        scheduleInfo.joinUserInfo && scheduleInfo.joinUserInfo["all"]>0?
                        <p className="detail_one">
                            <span className="one_name">参与人:</span>
                            <span className="one_value" data-sign="schedule">
                                {
                                    scheduleInfo.taskMemberVoList?.length?
                                    <>
                                    共<span style={{fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["all"]}</span>人,&nbsp;
                                    <span style={{color: "#009900", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["access"]}</span>人接受,&nbsp;
                                    <span style={{color: "#ff0000", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["reject"]}</span>人已拒绝,&nbsp;
                                    <span style={{color: "#333333", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["noResponse"]}</span>人未响应&nbsp;
                                    </>:
                                    <>
                                    <span style={{color: "#009900", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["access"]}</span>人已接受,&nbsp;
                                    <span style={{color: "#ff0000", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["reject"]}</span>人已拒绝,&nbsp;
                                    <span style={{color: "#ff6600", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["read"]}</span>人待定,&nbsp;
                                    <span style={{color: "#333333", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["noResponse"]}</span>人未读&nbsp;
                                    </>
                                }
                                <Popover
                                overlayClassName="task_user_detail schedule"
                                trigger={"click"}
                                placement="right"
                                content={
                                    <LgTabs 
                                    data={detailTabData}
                                    // titleItemStyle={{marginRight:20}}
                                    className="one_tabs"></LgTabs>
                                }>
                                    <svg data-sign="schedule" className="detaillogo" id="详情" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
                                    <rect id="矩形_3325" data-name="矩形 3325" width="1" height="14" fill="#09f"/>
                                    <rect id="矩形_3326" data-name="矩形 3326" width="2" height="1" transform="translate(3 6)" fill="#09f"/>
                                    <rect id="矩形_3328" data-name="矩形 3328" width="10" height="1" transform="translate(0 13)" fill="#09f"/>
                                    <rect id="矩形_3329" data-name="矩形 3329" width="1" height="4" transform="translate(13)" fill="#09f"/>
                                    <rect id="矩形_3330" data-name="矩形 3330" width="14" height="1" fill="#09f"/>
                                    <rect id="矩形_3331" data-name="矩形 3331" width="8" height="1" transform="translate(3 3)" fill="#09f"/>
                                    <path id="联合_184" data-name="联合 184" d="M-1504.2-3216.486a3.568,3.568,0,0,1-2.193.752,3.624,3.624,0,0,1-3.6-3.633,3.623,3.623,0,0,1,3.6-3.632,3.623,3.623,0,0,1,3.6,3.632,3.634,3.634,0,0,1-.692,2.139l1.483,1.494-.728.734Zm-4.768-2.882a2.588,2.588,0,0,0,2.575,2.6,2.551,2.551,0,0,0,1.69-.639l.251-.253a2.6,2.6,0,0,0,.634-1.7,2.588,2.588,0,0,0-2.575-2.594A2.588,2.588,0,0,0-1508.97-3219.368Z" transform="translate(1516 3228)" fill="#09f"/>
                                    <rect id="矩形_3332" data-name="矩形 3332" width="2" height="1" transform="translate(3 9)" fill="#09f"/>
                                    </svg>

                                </Popover>
                            </span>
                        </p>:
                        ""
                    }
                    {
                        child.beCourse === "1"||!child.scheduleContent?
                        "":
                        <p className="detail_one">
                            <span className="one_name">日程描述:</span>
                            <span className="one_value" title={child.scheduleContent}>
                            {
                                child.scheduleContent?
                                child.scheduleContent.length > 45? 
                                child.scheduleContent.substr(0, 45) + "...": 
                                child.scheduleContent:
                                "--"
                            }
                            </span>
                        </p>
                    }
                    {
                        moment(child.scheduleDate + " "+ child.startTime) > moment() &&
                        moment(child.scheduleDate + " "+ child.startTime).subtract(child.remindTime, "m").diff(moment(), "h") < 24?
                        <p className="detail_tip">
                            该日程将会在
                            {
                            
                                child.remindRealTime?
                                getTimeDiff(moment(child.remindRealTime).format("YYYY-MM-DD HH:mm"), "day"):
                                getTimeDiff(moment(child.scheduleDate + " "+ child.startTime).subtract(child.remindTime, "m").format("YYYY-MM-DD HH:mm"), "day")
                            }
                            后提醒您
                        </p>:
                        ""

                    }
                    
                </div>
            )}>
            {children}
            </Popover>
        )
    }, [changeCourse, deleteSchedule, detailTabData, editSchedule, getScheduleInfo, scheduleInfo]);


    useLayoutEffect(()=>{   //把获取到的日程列表按日期整合进表格中
        if(!chooseDate){
            return;
        }
        let year = moment(chooseDate).get("year");
        let month = moment(chooseDate).get("month")+1;
        let day = moment().get("date");
        let startWeek = new Date(year, month-1, 1).getDay();
        let maxDay = new Date(year, month, 0).getDate();
        let arr = [];
        for(let i = 1; i <= maxDay; i++){
            arr.push({
                day: i,
                dayText: i,
                date: year + "-" + month + "-" + i,
                week: moment(year + "-" + month + "-" + i).get("day"),
                list: []
            });
        }
        if(startWeek !== 1){
            for(let i = 0; i < startWeek - 1; i++){
                arr.unshift({});
            }
        }
        let existList = [];
        arr.forEach((item)=>{
            console.log(holidayList, 'holidayList')
            let obj = holidayList.filter(child=>moment(item.date).format("YYYY-MM-DD")===moment(child.date).format("YYYY-MM-DD"))[0];
            if(obj){
                if(!existList.includes(obj.holidayName)){
                    item.holidayName = obj.holidayName;
                }
                item.isHoliday = true;
                existList.push(obj.holidayName);
            }
            scheduleList.forEach((child)=>{
                if(item.date && moment(child.scheduleDate).format("YYYY-MM-DD") === moment(item.date).format("YYYY-MM-DD")){
                    item.list.push(child);
                }
            })
        })
       setTypeScheduleList(arr);
    }, [scheduleList, holidayList, chooseDate]);
    return (
        <div className="type_month_container">
            <div className="week_list">
                {
                    weekList.map((item, index)=>(
                        <div className="week_one" key={index}>
                            {item} 
                        </div>
                    ))
                }
            </div>
            {/* <Scrollbars style={{height: 490}}> */}
            <div className="schedule_table">
                {
                    typeScheduleList.map((item, index)=>{
                        return (
                            <div className={`schedule_one ${item.isHoliday||[6,0].includes(item.week)?"relax": ""}`} key={index}>
                                <div className="schedule_day">
                                    {item.day||""}
                                    <span className="day_text">{item.holidayName || getNumberHZ(item.date)}</span>
                                </div>
                                <ul className="schedule_list">
                                    {
                                        Array.isArray(item.list)?
                                        item.list.length < 3?
                                        item.list.map((child, index2)=>(
                                            constructSchedulePopover(child, index, index2, (
                                                <li key={index2} title={child.scheduleTitle||child.scheduleContent}>
                                                    <span className="li_content">
                                                    {child.scheduleTitle||child.scheduleContent}
                                                    </span>
                                                </li>
                                            ), 100)
                                        )):
                                        <Popover
                                        overlayClassName="date_table_cell_popover date_table_month-cell_popover"
                                        getPopupContainer={(trigger)=>document.body}
                                        trigger={"click"}
                                        zIndex={80}
                                        content={(
                                            <div className="date_table_cell_popover_content">
                                                <h3 className="date_table_cell_info">
                                                    <span>{moment(item.date).format("M月D日")}</span>
                                                    {getDateWeek(item.date)}
                                                </h3>
                                                <Scrollbars autoHeight autoHeightMax={150}>
                                                {
                                                    item.list.map((child, index2)=>(
                                                        constructSchedulePopover(child, index, index2, (
                                                            <p className="date_table_cell_schedule" key={index2} title={child.scheduleTitle||child.scheduleContent}>
                                                                {child.scheduleTitle||child.scheduleContent}
                                                            </p>
                                                        ), 99)
                                                        
                                                    ))
                                                }
                                                </Scrollbars>
                                            </div>
                                        )}>
                                            <div className="li-tip-total">共{item.list.length}个日程</div>
                                        </Popover>:
                                        ""
                                    }
                                </ul>
                            </div>
                        )
                    })
                }
            </div>
            
            {/* </Scrollbars> */}
        </div>
    )
}
const mapProps = (state) => {
    return {
        userInfo: state.userInfo,
        sysAddrInfo: state.sysAddrInfo,
        identityList: state.identityList,
        currentIdentity: state.currentIdentity,
        skinInfo: state.skinInfo,
        sysInfo: state.sysInfo,
        termInfo: state.termInfo,
        holidayList: state.holidayList
    }
}
export default connect(mapProps)(MyScheduleMonth);